#include "bit.h"



int k_bit_of_i(long long i, int k, int n)
{
    int l = 64;
    k = l - n + k;
    i = i >> (l - k);
    i = i & 1;
    return i;
}


long long set_k_bit_i_0(long long i, int k, int n)
{
    int l = 64;
    k = l - n + k;
    long long mask = 1L;
    mask = mask << (l - k);
    i = i & (~mask);
    return i;
}


long long set_k_bit_i_1(long long i, int k, int n)
{
    int l = 64;
    k = l - n + k;
    long long mask = 1L;
    mask = mask << (l - k);
    i = i | mask;
    return i;
}

complexd myrandom()
{
    double r, i;
    double a = 0.0, b = 10.0;
    r = (double)rand() / (double)RAND_MAX * (b - a) + a;
    i = (double)rand() / (double)RAND_MAX * (b - a) + a;
    complexd com(r,i);
    return com;
}
